#coding:utf-8

from sqlalchemy import Column
from sqlalchemy.types import Integer, BIGINT

from app_admin.extensions.mysql.mysql_base import Base
from ..extensions.mysql.session import sessionCM

class MAwardPool(Base):
    __tablename__ = 'ibb_awardpool'

    id = Column(Integer, autoincrement=True, nullable=False, unique=True, primary_key=True)
    cur_award_pool = Column(BIGINT, default=0)
    all_consume_gold = Column(BIGINT, default=0)
    cur_round_id = Column(Integer)

    def to_dict(self):
        return {"cur_round_id": self.cur_round_id, "cur_award_pool":self.cur_award_pool,
                "all_consume_gold":self.all_consume_gold}

    @classmethod
    def get_award_info(cls):
        with sessionCM() as session:
            ret = session.query(MAwardPool).first()
            return ret.to_dict() if ret else {}





    



